package com.e3.basdoc.cust.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.e3.core.base.SuperOCEntity;

@Entity
@Table(name = "T_CUSTOMER")
public class CustEntity extends SuperOCEntity {

	private static final long serialVersionUID = 8325377570225698259L;

	private String code;

	private String name;

	private String shortName;

	private int type;

	private int corpRelationship;

	private long parentId;

	private long regionId;

	private String businessAddress;

	private String contactAddress;

	private String fax;

	private String zipcode;

	private String telphone;

	private String email;

	private String legalPerson;

	private String legalPersonIdcard;

	private String contactPerson;

	private String contactWay;

	private long foundTime;

	private String remark;

	private String registerAddress;

	private String registerNo;

	private long registerStartTime;

	private long registerEndTime;

	private String taxNo;

	private long currencyId;

	private int taxpayerType;

	private List<CustAccountEntity> custAccounts;

	@Column(name = "CODE")
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "NAME")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "SHORT_NAME")
	public String getShortName() {
		return this.shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}

	@Column(name = "TYPE")
	public int getType() {
		return this.type;
	}

	public void setType(int type) {
		this.type = type;
	}

	@Column(name = "CORP_RELATIONSHIP")
	public int getCorpRelationship() {
		return this.corpRelationship;
	}

	public void setCorpRelationship(int corpRelationship) {
		this.corpRelationship = corpRelationship;
	}

	@Column(name = "PARENT_ID")
	public long getParentId() {
		return this.parentId;
	}

	public void setParentId(long parentId) {
		this.parentId = parentId;
	}

	@Column(name = "REGION_ID")
	public long getRegionId() {
		return this.regionId;
	}

	public void setRegionId(long regionId) {
		this.regionId = regionId;
	}

	@Column(name = "BUSINESS_ADDRESS")
	public String getBusinessAddress() {
		return this.businessAddress;
	}

	public void setBusinessAddress(String businessAddress) {
		this.businessAddress = businessAddress;
	}

	@Column(name = "CONTACT_ADDRESS")
	public String getContactAddress() {
		return this.contactAddress;
	}

	public void setContactAddress(String contactAddress) {
		this.contactAddress = contactAddress;
	}

	@Column(name = "FAX")
	public String getFax() {
		return this.fax;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	@Column(name = "ZIPCODE")
	public String getZipcode() {
		return this.zipcode;
	}

	public void setZipcode(String zipcode) {
		this.zipcode = zipcode;
	}

	@Column(name = "TELPHONE")
	public String getTelphone() {
		return this.telphone;
	}

	public void setTelphone(String telphone) {
		this.telphone = telphone;
	}

	@Column(name = "EMAIL")
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@Column(name = "LEGAL_PERSON")
	public String getLegalPerson() {
		return this.legalPerson;
	}

	public void setLegalPerson(String legalPerson) {
		this.legalPerson = legalPerson;
	}

	@Column(name = "LEGAL_PERSON_IDCARD")
	public String getLegalPersonIdcard() {
		return this.legalPersonIdcard;
	}

	public void setLegalPersonIdcard(String legalPersonIdcard) {
		this.legalPersonIdcard = legalPersonIdcard;
	}

	@Column(name = "CONTACT_PERSON")
	public String getContactPerson() {
		return this.contactPerson;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}

	@Column(name = "CONTACT_WAY")
	public String getContactWay() {
		return this.contactWay;
	}

	public void setContactWay(String contactWay) {
		this.contactWay = contactWay;
	}

	@Column(name = "FOUND_TIME")
	public long getFoundTime() {
		return this.foundTime;
	}

	public void setFoundTime(long foundTime) {
		this.foundTime = foundTime;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "REGISTER_ADDRESS")
	public String getRegisterAddress() {
		return this.registerAddress;
	}

	public void setRegisterAddress(String registerAddress) {
		this.registerAddress = registerAddress;
	}

	@Column(name = "REGISTER_NO")
	public String getRegisterNo() {
		return this.registerNo;
	}

	public void setRegisterNo(String registerNo) {
		this.registerNo = registerNo;
	}

	@Column(name = "REGISTER_START_TIME")
	public long getRegisterStartTime() {
		return this.registerStartTime;
	}

	public void setRegisterStartTime(long registerStartTime) {
		this.registerStartTime = registerStartTime;
	}

	@Column(name = "REGISTER_END_TIME")
	public long getRegisterEndTime() {
		return this.registerEndTime;
	}

	public void setRegisterEndTime(long registerEndTime) {
		this.registerEndTime = registerEndTime;
	}

	@Column(name = "TAX_NO")
	public String getTaxNo() {
		return this.taxNo;
	}

	public void setTaxNo(String taxNo) {
		this.taxNo = taxNo;
	}

	@Column(name = "CURRENCY_ID")
	public long getCurrencyId() {
		return this.currencyId;
	}

	public void setCurrencyId(long currencyId) {
		this.currencyId = currencyId;
	}

	@Column(name = "TAXPAYER_TYPE")
	public int getTaxpayerType() {
		return this.taxpayerType;
	}

	public void setTaxpayerType(int taxpayerType) {
		this.taxpayerType = taxpayerType;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "customer")
	public List<CustAccountEntity> getCustAccounts() {
		return custAccounts;
	}

	public void setCustAccounts(List<CustAccountEntity> custAccounts) {
		this.custAccounts = custAccounts;
		if(custAccounts!=null){
			for (CustAccountEntity custAccountEntity : custAccounts) {
				custAccountEntity.setCustomer(this);
			}
		}
	}

}
